/*
 * @(#)StartScreenState.java     14/08/02
 * 
 * Author             Rick Wilson
 * Copyright (c) 2014 Rick Wilson
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of 'Taareekah' nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */



package gui;

//~--- non-JDK imports --------------------------------------------------------

import com.jme3.asset.AssetManager;
import com.jme3.math.ColorRGBA;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Node;

import core.Main;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.controls.TextField;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

/**
 *
 * @author rick
 */
public class StartScreenState implements ScreenController {

    /** Field description */
    private Node	localRootNode	= new Node("Start Screen RootNode");

    /** Field description */
    private Node	localGuiNode	= new Node("Start Screen GuiNode");

    /** Field description */
    private final ColorRGBA	backgroundColor	= ColorRGBA.Gray;

    /** Field description */
    private ViewPort	viewPort;

    /** Field description */
    private Node	rootNode;

    /** Field description */
    private Node	guiNode;

    /** Field description */
    private AssetManager	assetManager;

    /** Field description */
    private Nifty	nifty;

    /** Field description */
    private Screen	screen;

    /** Field description */
    private Main	app;

    /** Field description */
    private TextField	load_world_filename_textfield;

    /**
     *
     * @param app
     */
    public StartScreenState(Main app) {
	this.rootNode		= app.getRootNode();
	this.viewPort		= app.getViewPort();
	this.guiNode		= app.getGuiNode();
	this.assetManager	= app.getAssetManager();
	this.app		= app;
    }

    /**
     *
     * @return
     */
    public String getLoadWorldFilename() {
	return load_world_filename_textfield.getDisplayedText();
    }

    /**
     *
     */
    public void loadWorld() {}

    /**
     *
     * @param nifty
     * @param screen
     */
    @Override
    public void bind(Nifty nifty, Screen screen) {
	this.nifty			= nifty;
	this.screen			= screen;
	load_world_filename_textfield	= screen.findNiftyControl("start_screen_load_world_filename_textfield",
		TextField.class);
	load_world_filename_textfield.setText("");
    }

    /**
     *
     */
    @Override
    public void onStartScreen() {}

    /**
     *
     */
    @Override
    public void onEndScreen() {}

    /**
     *
     * @param screen_name
     */
    public void goToScreen(String screen_name) {
	this.nifty.gotoScreen(screen_name);
    }

    /**
     *
     */
    public void exitGame() {
	this.app.stop();
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
